<template>
  <div id="echarts2"></div>
</template>

<script>
import * as echarts from "echarts";

export default {
  name: "Echarts2",
  data() {
    return {
      echarts:''
    }
  },
  mounted() {
    this.initEcharts()
  },
  methods: {
    initEcharts() {
      const chartDom = document.getElementById('echarts2')
      this.echarts = echarts.init(chartDom)

    },
    setEChartsOptions(data){
      const option = {
        title: {
          text: '项目任务统计:',
          // subtext: ' Data',
          top: 'left'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'right'
        },
        color:['#5470c6','#91cc75','#3ba272'],
        series: [
          {
            name: '项目状态',
            type: 'pie',
            radius: '50%',
            data: [
              {value: data.un_start_count, name: '未开始'},
              {value: data.start_count, name: '进行中'},
              {value: data.complete_count, name: '已完成'},
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      this.echarts && this.echarts.setOption(option);
    },
  }
}
</script>

<style scoped lang="scss">
#echarts2{
  width: 100%;
  height: 100%;
}
</style>
